package org.dfl.plugin.perspectives;

import org.dfl.plugin.navigator.ProjectNavigator;
import org.dfl.plugin.views.debug.HistoriesTreeView;
import org.dfl.plugin.views.debug.TokensTreeView;
import org.dfl.plugin.views.palette.PaletteView;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;

/**
 * perspective used to create and edit a dataflow
 * @author Piotr Wlodarczyk
 *
 */
public class DflPerspective implements IPerspectiveFactory {
	public final static String ID = "org.dfl.plugin.perspectives.dflperspective";
	
	public void createInitialLayout(IPageLayout layout) {
		String editorArea = layout.getEditorArea();

		// before Resource Navigator = IPageLayout.ID_RES_NAV
		layout.addStandaloneView(ProjectNavigator.ID, true, IPageLayout.LEFT, 0.18f, editorArea);
		layout.getViewLayout(ProjectNavigator.ID).setCloseable(false);

//		IFolderLayout topLeft = layout.createFolder("topleft",IPageLayout.LEFT,0.18f,editorArea);

		// La vue "Tasks".
		IFolderLayout bottom = layout.createFolder("bottom",IPageLayout.BOTTOM,0.80f,editorArea);
		bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
		bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);
		
	    layout.addView(PaletteView.ID,  IPageLayout.RIGHT, 0.70f, editorArea);
	    layout.setEditorAreaVisible(true);
	    layout.setFixed(true);setContentsOfShowViewMenu(layout);
	}
	
	/**
	 * Sets the intial contents of the "Show View" menu.
	 */
	protected void setContentsOfShowViewMenu(IPageLayout layout) {
		layout.addShowViewShortcut(TokensTreeView.ID);
		layout.addShowViewShortcut(HistoriesTreeView.ID);
		layout.addShowViewShortcut(ProjectNavigator.ID);
		layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
		layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
	}
}
